<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <div ref="test">{{msg}}</div>
        <button @click="set">test</button>

    </div>
    <script>
    new Vue({
        el:"#app",
        data:{
            msg:"韩梅梅你好"
        },
        methods:{
            set(){
                this.msg="今天天气不错",
                //console.log(this.$refs.test.innerText); //1.韩梅梅你好  2~:今天天气不错
                this.$nextTick(()=>{
                    console.log(this.$refs.test.innerText);//今天天气不错 基于视图更新之后调用
               })
                
            }
        }
    })
    
    </script>
    
</body>
</html>